package com.zfei.gfb.request;

import cn.hutool.core.lang.Validator;
import com.zfei.gfb.bean.Const;
import com.zfei.gfb.bean.Status;
import com.zfei.gfb.bean.StatusException;
import com.zfei.gfb.util.ObjUtil;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;


/**
 * @author fgh
 */
public class GfbCompanyAuditRequest {

    // id
    @ApiModelProperty(value = "企业用户id", required = true)
    private Integer id;
    // 通过/不通过
    @ApiModelProperty(value = "通过value: 2/不通过value:3", required = true)
    private Integer audit;
    // 不通过原因
    @ApiModelProperty(value = "不通过原因", required = false)
    private String reason;

    public void setId(Integer value) {
        this.id = value;
    }

    public Integer getId() {
        return this.id;
    }

    public Integer getAudit() {
        return audit;
    }

    public void setAudit(Integer audit) {
        this.audit = audit;
    }

    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    public void checkUpdateNull() {
        if (ObjUtil.anyNull(id, audit)) {
            throw new StatusException(Status.INVALID_ARGUMENT);
        }
        if (audit != Const.COMPANY_AUTH_SUCCESS && audit != Const.COMPANY_AUTH_FAIL) {
            throw new StatusException(Status.INVALID_ARGUMENT);
        }
        if (audit == Const.COMPANY_AUTH_FAIL && StringUtils.isBlank(reason)) {
            throw new StatusException(Status.INVALID_ARGUMENT);
        }
    }
}

